package com.atguigu.edu.controller.front;

import com.atguigu.edu.entity.Course;
import com.atguigu.edu.entity.Teacher;
import com.atguigu.edu.service.CourseService;
import com.atguigu.edu.service.TeacherService;
import com.atguigu.utils.R;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/eduservice/indexfront")
//@CrossOrigin
@Api(description = "前台首页管理",value = "前台首页管理")
public class IndexFrontController {
    @Resource
    private CourseService courseService;
    @Resource
    private TeacherService teacherService;

    @GetMapping("/index")
    public R index(){

        List<Course> courseList=courseService.getIndexCourse();

        List<Teacher>  teacherList=teacherService.getIndexTeacher();


        return R.ok().data("teacherList",teacherList).data("courseList",courseList);
    }
}
